Return to doc.sitecore.com

Templates and the Default Workflow Field
Prev Next

Author: Kerry Bellerose
Posted: 12/9/2005 3:05:00 PM

Sitecore version: 5.1.1 and 5.2.

Sitecore recommends that developers associate Items with a Workflow at the Template level.  This is done by setting the Default Workflow field on the Template.  The other three Workflow fields (Workflow, State, and Lock), should always be blank on a Template.  Sitecore recommends that all four Workflow fields be left blank on a Master.

Using this approach, developers can then change the Workflow associated with all the Items based on a given Template just by changing the Default Workflow field on the given Template.

Here's a description of how this works:

  1. The user creates some Items based on a Master M1, which is based on a Template T1 which has a Default Workflow set to W1.  The Workflow fields are not set in Master M1. 
     
  2. At some later point, the developer changes the Template T1’s Default Workflow to W2.  

    At this point, any items in W1 will stay in their current state in W1 until they complete the workflow (this is because we can’t guess which state they would be moved to in W2). 

    For any Items in W1’s final state, when the user selects the Edit button, Sitecore will create a new version and place it in W2’s default state.  In this way, the Workflow for existing Items has been changed.

Setting the Default Workflow value in the Master is not a good idea, since it will copy the value into each Item, which means the value will not be inherited from the Item’s Template and the inheritance described above will not work.

This works today.

There is a known bug associated with this, however.  If an Item was created based on a Template where the Default Workflow as set to NONE, then the Template’s Default Workflow field is later changed to a workflow, the existing Item’s workflow will not be changed.  This will be fixed in a later released. 


Prev Next